/*
 * nlsync
 * Copyright (c) 2010 apechurin 
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
using System;
using System.Collections.Generic;
using System.Text;

namespace nlsync
{
    /// <summary>
    /// The interface of a bundle that stores a list of strings and allows 
    /// modify it. Use IStringCatalog to get an instance of the interface.
    /// Each bundle has its own unique name. All methods can throw Exception 
    /// in a error case. The interface extends IEnumerable which allow to 
    /// enumerate all strings of the bundle. Removing of a currently enumerated
    /// string should be supported by any implementation.
    /// </summary>
    public interface IStringBundle : IEnumerable<IStringInfo>
    {
        /// <summary>
        /// Finds a string by its name.
        /// </summary>
        /// <param name="name">The string name.</param>
        /// <returns>The string or null if not found.</returns>
        IStringInfo Find(string name);

        /// <summary>
        /// Adds a new string.
        /// </summary>
        /// <param name="name">The name of the string.</param>
        /// <returns>The new string. Only name field is set.</returns>
        IStringInfo Add(string name);

        /// <summary>
        /// Removes a string.
        /// <param name="str">The string to remove.</param>
        /// </summary>
        void Remove(IStringInfo str);

        /// <summary>
        /// Are the comments supported by the bundle?
        /// </summary>
        bool IsCommentSupported
        {
            get;
        }

        /// <summary>
        /// Closes the bundle. Saves all changes if necessary. The bundle 
        /// cannot be used anymore.
        /// </summary>
        void Close();
    }
}
